home *** CD-ROM | disk | FTP | other *** search
/ Chip 2004 April / CMCD0404.ISO / Software / Shareware / Programare / sharp / wwwSharp_setup.exe / {app} / Examples / Data access / DataBindings (DataSet and DataView) / DataBindings.wsits (.txt) < prev    next >
Windows Compiled HTML Help File  |  2003-12-23  |  10KB  |  80 lines

  1. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
  2. <HTML>
  3. <HEAD>
  4.     <TITLE>www-Sharp.ClrHost DataSet and DataView example</TITLE>
  5.     <META name="GENERATOR" content="MSHTML 6.00.2800.1264">
  6.     <META http-equiv="MSThemeCompatible" content="Yes">
  7.     <OBJECT id="dsNorthwind" classid="clsid:A53ECD51-C062-4B08-97F0-4944CD7D88E7">
  8.         <PARAM name="AssemblyName"
  9.             value="System.Data, Version=1.0.5000.0, PublicKeyToken=b77a5c561934e089, Culture=neutral">
  10.         <PARAM name="DataAdapterTypeName" value="System.Data.SqlClient.SqlDataAdapter">
  11.         <PARAM name="ConnectionTypeName" value="System.Data.SqlClient.SqlConnection">
  12.         <PARAM name="ConnectionString" value="Integrated Security=SSPI;Database=Northwind;">
  13.         <PARAM name="TABLE_customers" value="Select * from customers">
  14.     </OBJECT>
  15.     <OBJECT id="viewCustomers" classid="clsid:E3BC8FCA-E3F4-4B98-8627-9D3D343F9DA0">
  16.         <PARAM name="DataSetID" value="dsNorthwind">
  17.         <PARAM name="TableName" value="customers">
  18.         <PARAM name="UseView" value="true">
  19.         <PARAM name="Filter" value="CustomerID < 'S'">
  20.         <PARAM name="Sort" value="ContactName">
  21.         <PARAM name="RowStateFilter" value="CurrentRows">
  22.     </OBJECT>
  23. <STYLE>
  24. TH
  25. {
  26.     background-color: #99CC33;
  27. }
  28.  
  29. TD
  30. {
  31.     background-color: #00FF99;
  32. }
  33.  
  34. BUTTON
  35. {
  36.     width: 100px;
  37. }
  38. </STYLE>
  39. <SCRIPT>
  40. window.onload = Fill;
  41.  
  42. function Fill()
  43. {
  44.     var i;
  45.     var str = "<TABLE id=\"tblCustomers\" dataSrc=\"#viewCustomers\" border=\"0\" width=\"100%\" dataPageSize=\"10\">\r\n";
  46.  
  47.     var rs = viewCustomers.recordset;
  48.     if (rs == null)
  49.     {
  50.         window.alert("Recordset is not valid");
  51.         return;
  52.     }
  53.     
  54.     str += "<THEAD>\r\n<TR>\r\n";
  55.     for (i = 0; i < rs.Fields.Count; i++)
  56.         str += "<TH>" + rs.Fields.Item(i).Name + "</TH>\r\n";
  57.     str += "</TR>\r\n</THEAD>\r\n";
  58.  
  59.     str += "<TBODY>\r\n<TR>\r\n";
  60.     for (i = 0; i < rs.Fields.Count; i++)
  61.         str += "<TD><SPAN dataFld=\"" + rs.Fields.Item(i).Name + "\"></SPAN></TD>\r\n";
  62.     str += "</TR>\r\n</TBODY>\r\n";
  63.     
  64.     str += "</TABLE>";
  65.  
  66.     tblCustomers.outerHTML = str;
  67. }
  68. </SCRIPT>
  69. </HEAD>
  70. <BODY>
  71.     <BUTTON id="btnFirst" onclick="tblCustomers.firstPage()">< <</BUTTON>
  72.     <BUTTON id="btnPrev" onclick="tblCustomers.previousPage()"><</BUTTON>
  73.     <BUTTON id="btnNext" onclick="tblCustomers.nextPage()">></BUTTON>
  74.     <BUTTON id="btnLast" onclick="tblCustomers.lastPage()">> ></BUTTON>
  75.     <TABLE id="tblCustomers">
  76.         <TBODY></TBODY>
  77.     </TABLE>
  78. </BODY>
  79. </HTML>
  80.